package com.mhh.selary.backend.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author mhh
 * @date 2020-09-02 17:45:12
 */
@Getter
@AllArgsConstructor
public enum PropKeyEnum {

    /**
     *
     */
    JDBC_HOST("jdbc.host", "Ip及端口"),

    JDBC_USERNAME("jdbc.username", "用户名"),

    JDBC_PASSWORD("jdbc.password", "密码"),

    JDBC_SCHEMA("jdbc.schema", "数据库名称"),

    REDIS_HOST("redis.host", "Ip及端口"),

    REDIS_PASSWORD("redis.password", "密码"),

    REDIS_DATABASE("redis.database", "数据库索引"),

    MONGODB_HOST("mongodb.host", "Ip及端口"),

    MONGODB_DB("mongodb.db", "数据库名称"),
    ;

    private String name;

    private String desc;

    public static PropKeyEnum valueBy(String name) {
        return Arrays.stream(PropKeyEnum.values()).filter(enumItem -> enumItem.getName().equals(name)).findFirst().orElse(null);
    }
}
